package Clain;

import Command.StopOperationCommand;
import Factory.AgriculturalMachine;
import Command.RemoteController;
import State.MachineState;

public class FaultHandler extends AbstractSafetyHandler {
    private RemoteController remoteController;

    public FaultHandler(RemoteController remoteController) {
        this.remoteController = remoteController;
    }

    @Override
    protected boolean canHandle(SafetyEvent event) {
        return event.getType() == SafetyEventType.MACHINE_FAULT;
    }

    @Override
    protected void process(SafetyEvent event) {
        System.out.println("【农机故障处理器】处理事件: " + event.getDescription());

        // 获取受影响的农机
        AgriculturalMachine affectedMachine = (AgriculturalMachine) event.getSource();



        // 2. 记录故障代码和信息
        System.out.println("- 故障代码: " + event.getCode());
        System.out.println("- 故障详情: " + event.getDetails());

        // 3. 通知维修部门
        System.out.println("- 已通知维修团队: " + event.getDetails());

        event.setResolved(true);
    }
}